﻿using MediatR;
using ProduceBasicData.ErrorCode;
using ProduceBasicData.Domain.Material;

namespace ProduceBasicData.Api.Application.Command.Material.BOM
{
    /// <summary>
    /// 新增BOM
    /// </summary>
    public class CreateBOMCommand : IRequest<ApiResult<int>>
    {
        /// <summary>
        /// 是否作为某一BOM的下级
        /// </summary>
        public bool IsChild { get; set; }
        /// <summary>
        /// 上级BOM名称（用于计算层级，仅当 IsChild=true 时使用）
        /// </summary>
        public string? ParentBOMName { get; set; }
        /// <summary>
        /// 上级BOM版本（用于计算层级，仅当 IsChild=true 时使用）
        /// </summary>
        public string? ParentBomVersion { get; set; }
        /// <summary>
        /// 当通过产品物料添加下级时，指定产品物料Id
        /// </summary>
        public int? ProductMaterialId { get; set; }
        /// <summary>
        /// 群组物料ID
        /// </summary>
        public int? MaterialGroupId { get; set; }
        /// <summary>
        /// 父级BOM ID（用于添加下级）
        /// </summary>
        public int? ParentBOMId { get; set; }
        /// <summary>
        /// BOM编码
        /// </summary>
        public string BOMCode { get; set; }
        /// <summary>
        /// BOM名称
        /// </summary>
        public string BOMName { get; set; }
        /// <summary>
        /// BOM版本
        /// </summary>
        public string BomVersion { get; set; }
        /// <summary>
        /// BOM类型
        /// </summary>
        public string BomType { get; set; }
        /// <summary>
        /// BOM阶别
        /// </summary>
        public string BOMSteps { get; set; }
        /// <summary>
        /// BOM层级编码
        /// </summary>
        public int BOMLevel { get; set; }
        /// <summary>
        /// 工序外键
        /// </summary>
        public int ProcessId { get; set; }
        ///// <summary>
        ///// 工序编码
        ///// </summary>
        //public string ProcessCode { get; set; }
        ///// <summary>
        ///// 工序名称
        ///// </summary>
        //public string ProcessName { get; set; }
        /// <summary>
        /// BOM用量
        /// </summary>
        public int? BOMDosage { get; set; }
        /// <summary>
        /// BOM描述
        /// </summary>
        public string BOMDesc { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        public string CreateName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新人
        /// </summary>
        public string? UpdateName { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }
    }
}
